package com.cv.audit.service.video;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjUtil;
import com.cv.audit.controller.audit.video.vo.AuditVideoLogPageReqVO;
import com.cv.audit.controller.audit.video.vo.AuditVideoLogRespVO;
import com.cv.audit.controller.audit.video.vo.AuditVideoLogSaveReqVO;
import com.cv.audit.dal.dataobject.video.AuditVideoLogDO;
import com.cv.audit.dal.mapper.video.AuditVideoLogMapper;
import com.cv.framework.common.pojo.PageResult;
import com.cv.framework.security.core.utils.SecurityFrameworkUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 视频审核日志业务层接口实现类
 *
 * @author Charles_XDXD
 */
@Service
public class AuditVideoLogServiceImpl implements AuditVideoLogService {

    @Resource
    private AuditVideoLogMapper auditVideoLogMapper;

    @Override
    public void saveAuditVideoLog(AuditVideoLogSaveReqVO reqVO) {
        if (ObjUtil.isNotEmpty(reqVO)) {
            AuditVideoLogDO auditVideoLogDO = BeanUtil.toBean(reqVO, AuditVideoLogDO.class);
            auditVideoLogDO.setUserId(SecurityFrameworkUtil.getLoginUserId());
            auditVideoLogMapper.insert(auditVideoLogDO);
        }
    }

    @Override
    public PageResult<AuditVideoLogRespVO> getPage(AuditVideoLogPageReqVO reqVO) {
        return auditVideoLogMapper.getPage(reqVO);
    }

}
